<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<SCRIPT type="text/javascript">
   var loadProductInfo=function(){
    			var productCode = $("#productCode").val(),periodDay = $("#periodDay").val(),totalMoney = $("#totalMoney").val();
				$.ajax({   
				    url:'${ctx}/management/product/loadProduct.do?productCode='+productCode+"&periodDay="+periodDay+"&totalMoney="+totalMoney,   
				    type:'post',   
				    async : true, //默认为true 异步   
				    error:function(){   
				       alert('error');   
				    },   
				    success:function(data){
				    	var rtnObj = eval('(' + data + ')');
			    		if(rtnObj.yearRate!=null){
			    			$("#yearRate").val(rtnObj.yearRate);
			    			$("#yearCredit").val(rtnObj.yearCredit);
			    			$("#realIncome").val(rtnObj.realIncome);
			    		}
			    		if($("#interestStartDate").val()==""){
			    			$("#interestStartDate").val(rtnObj.interestStartDate);
			    		}
			    		
			    		if($("#interestEndDate").val()==""){
			    			$("#interestEndDate").val(rtnObj.interestEndDate);
			    		}
				    }
				})
    };
    
   	$("#bankCode").on("afterchange.bjui.lookup", function(e, data) {
	     $('#bankCode').selectpicker('val', data.value);
	});
    
	$(document).ready(function(){
	     
		$("#productCode").bind("blur", function(){
			loadProductInfo();
		});
		
		$("#periodDay").bind("blur", function(){
			loadProductInfo();
		});
		
		$("#totalMoney").bind("blur", function(){
			loadProductInfo();
		});
		
		$("#yearCredit").bind("onblur", function(){
			loadProductInfo();
		});
		
		
	})
	
</SCRIPT>
<div class="bjui-pageContent">
    <form action="${ctx}/management/order/update.do" data-toggle="validate" data-reload-navtab="true">
        <input type="hidden" name="intID" value="${vo.intID}">
      	    <table class="table table-condensed table-hover" width="98%">
                  <tbody>
                	 <tr>
                	 	<td>
                            <label class="control-label ">合同号：</label>
                            <input type="text" id="contractNum" name="contractNum"  readonly="readonly" data-rule="required" value="${vo.contractNum}" size="20">
                        </td>
                        <td>
                	 	    <input type="hidden" name="orgCode" value="${vo.orgCode}">
                            <label class="control-label ">签约员工：</label>
                              <select name="staffNum" data-toggle="selectpicker"  data-width="200">
                              	<c:forEach var="paramObj" items="${staffList}">
                           			 <option value="${paramObj.staffNum}" <c:if test="${paramObj.staffNum eq vo.staffNum}">selected="selected"</c:if>>${paramObj.staffName}</option>
                            	 </c:forEach>
                              </select>
                        </td>
                 	   </tr>
                 	   
                 	   <tr>
	                	 	<td>
	                            <label class="control-label ">投资客户：</label>
	                            	<input type="hidden" name="custId" id="custId" value="${vo.custId}">
	                            	<input type="text" name="custName" id="custName"  data-rule="required" value="${vo.custName}" data-toggle="lookup" data-url="management/order/showCustList.do?orgCode=${vo.orgCode}&staffNum=${vo.staffNum}" data-width="600" data-height="450">
	                        </td>
	                        
	                	 	<td>
	                	 		 <label class="control-label ">受益客户</label>
	                	 		  <input type="hidden" name="interestId" id="interestId"   value="${vo.interestId}">
	                	 		 <input type="text" name="interestName" id="interestName"  data-rule="required" value="${vo.interestName}" readonly="readonly">
	                        </td>
                 	   </tr>
                 	   
                 	    <tr>
	                	 	<td>
	                            <label class="control-label ">身份证号：</label>
	                            <input type="text" name="identityNum"  data-rule="required" value="${vo.identityNum}" size="20">
	                        </td>
	                        
	                        <td>
	                            <label class="control-label ">联系电话：</label>
	                            <input type="text" name="linkPhone"  data-rule="required" value="${vo.linkPhone}" size="20">
	                        </td>
                 	   </tr>
                 	  <tr>
                        <td >
                            <label class="control-label ">银行名称：</label>
                             <select class="selectpicker show-tick" name="bankCode" data-width="200"  data-rule="required"  data-toggle="selectpicker" >
                           		<c:forEach var="paramObj" items="${SYS_BANKNAME}">
                           			 <option value="${paramObj.value2}" <c:if test="${paramObj.value2 eq vo.bankCode}">selected="selected"</c:if>>${paramObj.value1}</option>
                            	 </c:forEach>
	                        </select>
                        </td>
                         <td>
                            <label class="control-label ">银行卡号：</label>
                            <input type="text" name="bankAccount" value="${vo.bankAccount}" size="20">
                        </td>
                     </tr>
                     <tr>
	                        <td>
	                           	 <label class="control-label"> 投资产品： </label>
	                     		 <select class="selectpicker show-tick" id="productCode" name="productCode" data-width="200"  data-toggle="selectpicker" >
	                           		<c:forEach var="paramObj" items="${productList}">
	                           			 <option value="${paramObj.productCode}" <c:if test="${paramObj.productCode eq vo.productCode}">selected="selected"</c:if>>${paramObj.productName}</option>
	                            	 </c:forEach>
	                       		 </select>
	                        </td>
	                         <td>
	                            <label class="control-label ">投资金额(元)：</label>
	                            <input type="text" id="totalMoney" name="totalMoney" value="${vo.totalMoney}" data-rule="required"  size="20">
	                        </td>
                	   </tr>
                	   <tr>
                 	   	 <td>
                            <label class="control-label ">投资期限(月)：</label>
                            <input type="text" id="periodDay" name="periodDay" value="${vo.periodDay}" data-rule="required" size="20" >
                        </td>
                        
                        <td>
                            <label class="control-label ">年化收益：</label>
                            <input type="text" id="yearRate" name="yearRate"  value="${vo.yearRate}"  data-rule="required" size="20" >
                        </td>
                     </tr>
                     <tr>
                         <td>
                            <label class="control-label">年化额度：</label>
                            <input type="text" id="yearCredit" name="yearCredit"   value="${vo.yearCredit}" size="20">
                        </td>
                        <td>
                            <label class="control-label ">总收益：</label>
                            <input type="text" id="realIncome" name="realIncome"   value="${vo.realIncome}" size="20">
                        </td>
                    </tr>
                    <tr>
                      	<td>
                            <label class="control-label ">计息开始日：</label>
                            <input type="text" id="interestStartDate" name="interestStartDate" value="${vo.interestStartDate}" size="20"  data-toggle="datepicker" data-rule="required;date">
                        </td>
                        
                        <td>
                            <label class="control-label ">计息结束日：</label>
                            <input type="text" id="interestEndDate" name="interestEndDate" value="${vo.interestEndDate}" size="20"  data-toggle="datepicker" data-rule="required;date">
                        </td>
                 	 </tr>
                 	 
                 	  <tr>
                      	<td>
                            <label class="control-label ">订单来源：</label>
                             <select class="selectpicker show-tick" name="orderSource"  data-width="200" data-rule="required"  data-toggle="selectpicker" >
                           		<c:forEach var="paramObj" items="${SYS_ORDERSOURCE}">
                           			 <option value="${paramObj.value2}" <c:if test="${paramObj.value2 eq vo.orderSource}">selected="selected"</c:if>>${paramObj.value1}</option>
                            	 </c:forEach>
	                        </select>
                        </td>
                        
                        <td>
                        	   <label class="control-label ">订单状态：</label>
	                             <select class="selectpicker show-tick" name="orderStatus"  data-width="200" data-rule="required"  data-toggle="selectpicker" >
	                           		<c:forEach var="paramObj" items="${SYS_ORDERSTATUS}">
	                           			 <option value="${paramObj.value2}" <c:if test="${paramObj.value2 eq vo.orderStatus}">selected="selected"</c:if>>${paramObj.value1}</option>
	                            	 </c:forEach>
		                        </select>
                        </td>
                 	 </tr>
                 	 
                 	 <tr>
	                      	<td colspan="2">
	                            <label class="control-label ">备注：</label>
	                            <textarea name="strRemark" id="j_custom_note" data-toggle="autoheight"  cols="55" rows="1">${vo.strRemark}</textarea>
	                        </td>
                 	 </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
    </ul>
</div>